<%@ page pageEncoding="UTF-8" %>
<script>
    $(function () {
        $('#myArticleTable').datagrid({
            url:'${pageContext.request.contextPath}/article/selectArticle',
            pagination:true,
            columns:[[
                {field:'articleId',title:'编号',width:20},
                {field:'articleName',title:'文章名字',width:150},
                {field:'articleImage',title:'文章图片',width:35,
                    formatter:function (value,rowData,index) {
                        return "<img src='${pageContext.request.contextPath }/img/"+value+"' style=width:30px;height:30px;>"
                    }
                },
                {field:'articleContent',title:'文章内容',width:200},
                {field:'guruName',title:'文章作者',width:70},
                {field:'articleDate',title:'时间',width:125},
            ]]
        });
    })

    //检索
    function articlejs() {
        var ArticleJS = $("#ArticleJS").val();
        $('#myArticleTable').datagrid('load', {
            "ArticleJS":ArticleJS,
        });
    }
    
    
    //重置索引库
    function articlecz() {
        $.ajax({
            url:"${pageContext.request.contextPath}/article/reset",
            success:function (data) {
                if(data.reset){
                    alert("索引库重置成功");
                }else {
                    alert("索引库重置失败");
                }
            }
            
            
            
            
        })
    }




</script>

<input type="text" id="ArticleJS" name="ArticleJS">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="articlejs()">检索</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="articlecz()">重置索引库</a>
<table id="myArticleTable"></table>

